Handle undefined javascript errors