Version 3: various bugfixes