more robust version check