bug and performance fixes
fixed more bugs