Fixed issues found by running it locally