fix gradient tests. solves #57