Fixes from @deian's comments