Fixed a model bug and add discovery support