Found a little bug in the Armature Joining code due to the 'imat' var being defined twice and used for two different things. This was brought to light by Valgrind output (thanks Campbell)