handle errors properly in firefox