some changes and bug fixes.