wrong signal calculating substr with negative starting position