Fixes for PHP errors