Fixed bug with caching inputs.