Fixed #21, #22, #32, #33