bug fix for wall checking