port to rust master (post 0.9)