bugfixes so that error message is correct