fixed bugs around input byte and sparse state vector