refactor version check