Fix #184, Fix #186, Fix #187
Just some minor issues like dead code.