bugfixes to make the code compile