fixed large gradient warnings and other minor fixes