update logging and check is SimpleXMLElement object exists or not instead of checking if it's empty