Optimize version check