Fixes issues mentioned on pull request