Fix detection of tags when the current tag is not a valid version