fix most performance issues