Fixes suggested by @rock3r