fixed #2 and finished #8