fixed bugs that came with performance fix