fixes from @danielkeep