Added a compatibility fix for PHP < 5.2.1 (implemented sys_get_temp_dir())