bugfixes to user input and flag handling