Minor bugfixes (thanks @pmagaz!)