Cannot read property 'status' of undefined