small optimization tweaks