hack: using loc instead of pointer to prev. node. Sometimes works; critical bugs remain