fixed collision resolution logic