a lot of bug fixes for 2.1 release