Fix misc bugs and refine adding plan