add fade transition and fix bug