some performance fixes