minor bugfixes (thanks @shanem)