Fixed bug.
s0 was an int, so derivative was not working.