Fix substring error.