lots of input related bugs fixed