fixes and performance enhancements