Fixed decoding into memory and adapted to non-GNU systems