port fixes from 1.0.x