fixed #19, fixed #20, fixed #21, fixed #22, fixed #23