Bugfixes and tests from node-semver