Fix onError happening in constructor