make the check for defined rather than 0