added additional debug information and fixed some issues with typelinks()