src: fixed nullpointer bug during removal