Some bugfixes

... i swear i'm not drunk-coding :|