improvement to collision check