fixed bugs in input wrapper