change the version check logic to be flatter