Adds check to prevent php error