some fixes for daniels gradient part