fixed wall detection code