Bug fixes for php notices