fixed some slowdown bugs