Add tin tools

Fixed some potential issues discovered by Karsten.