Fix MAC generation