Some fixes to prevent errors in CakePHP

Added the fixes as mentioned here:
http://bakery.cakephp.org/articles/segy/2012/04/02/phpexcel_helper_for_generating_excel_files