adds null guard; changes POST response to 501