Avoid PHP notices by checking for variables' existence