Fixed backwards compatibility for to_obj