Fixed #17, #6, #45