couple of bugs fixes