fixed #19, #20, #23, #24, #25