fixed #31, fixed #30, fixed #29