fixed some bugs caused by faulty find-replaces