fixed couple of bugs