fixing #7, #6, #5, #4