improve version detection as suggested by mvidner