Eliminate PHP notice and warning messages

Some minor bugs cause PHP notice and warning massages(Undefined index, Undefined offset, Illegal string offset).