fix a bit of bugs