fixed some speed issues