fix creating errors to be reported properly by browser