slight logic tweak in space check.