fix some bugs discovered whilst trying to make a model