fixed some performance issues