fix embarassing bugs in get_bounds
make check_grad controllable with a command line arg