Bugfixes (thanks @bgotink)