Improved type guessing/fixed some issues.