Fix potential problem with features starting at 0s
Improve tests