Truncate fixes

Fix the issues in #3 + add some more testing