Fix some bugs and add clear form option