Merged @andybalholm's patch: Related issue #13