Fix a lot of error when error_reporting(E_ALL) is ON.

There is a lot of errors when you set error_reporting(E_ALL). I have fixed most of the errors.