Added a condition to prevent php notices