some fixes for performance