Robust surface detection

. Made some debug interface changes
. Made surface detection more robust by forcing the z of the x-sample
same as the original