Added check to avoid PHP notice