Enhance functionalities and fix bug.