Fixes suggested by @probins