added validation to addfragment