add fixes from ryanhamshire