integrated Steve's patch by hand