fixes from bruceharris and Virakal