Fix bug in version detection