fixes suggested by @zcorpan