fixed a couple of bugs in fragment implementation