Fixed #171 and fixed #172