bugfixes to get the program working