Fixed null vs 'null' error when encountering an error