Fix setting master key in build_headers