Morphogen profiles can be optimized to buffer against noise