fix version extraction and add some tests