correct a little implementation mistakes