Fix #385, Fix #386, Fix #387