pull request from Marko Lahma