improve from_local method