Avoid cast and version comparison