fixes from @tomzx