various bugfixes to make the program work properly