improved version check