some bugfixes -- cause I didn't actually test