Fix bug in plot_profiles