fixing a bug in potential 2DFromFunction