more Bug fixes and performance tweaks