add losses back to write packet functions