fixed a little bug and add an improvement