Revert "Missed null check may cause NPE"

This reverts commit 54735519943819e32df9aadcb81e9142f32e4cef. This commit seems to be causing issues in rest test cases. While the code looks good additional testing will need to be done to figure out the cause of the problems.