add split preview mode and fix some bugs