Fix null dereferencing issues found by Coverity in changes made for EUCA-9453 and EUCA-9590