some obvious performance fixes