Fixed typo in chgtype function