Some performance fixes for the array