merge actual changes from development head

Includes a proper cross platform implementation of leadfile