Feature #4977: Improve decompress function