bug fix / performance tweaks