Add mode and bug fix