osm improvements

This pull request has improvements for some OSM operations and fixes several bugs.