Fix _resolve_model to work with unicode strings