some changes, fixed bugs