fixed issues with default xmin and xmax depending on the function