fixed "generate_mac" func