fixed bug with 1s being discarded