bugfixes after #2 and #3 :(