updated error handling. minor encoding fixes. strict_mode