Small performance improvement on contract validation