fixed errors with struct unpack