Perhaps it would be better to use reltol here?