restructure PS1 and fix bug