fixing some bugs Webstorm found