improved error checking in condenseBytes