Fixed #118 and #143