fixed some speed issues.