Fixed issues with code