fixed #3, fixed #29, fixed #32