Fixes submitted as pull request