fix a bug and add a log