Fixed #103, #102, #97.