add comment and fix minor bug