You did the right thing. Seeing this I also would have suggested using LooseVersion.