fix couple of bugs