Fixed Some bugs