hardened by inserting one more check for null