Implementation of decompression stream checking and better error throwing.