fix most of bugs