Fix undefined has no method 'status' error