If result is undefined wrong error is thrown