Fixed a few typos, and made it compatible with
earlier versions of php