fixed the sid truncation issue and added tests for it, fixes #373