Fixes from inital pull request