removed php4 compat functions, code cleanup