Fixed a bunch of errors PHPStorm showed up.