fix bugs in unit-input