Fixed check for defined variable