LP#1367926: various improvements and bugfixes