Add if condition to avoid php notices

Issue #109