clean up and fixing for newer SWF and php libs