Added check for isAir to fix potential issues.