fixed #5, #6, #8