Fix random throwing of exceptions