Fixed issues with the performance improvements made earlier