Fix bug in javascript that prevented it from adding selected variant to list

Fixes #42