Minor perfomance fixes