Updated for new termlib
Detect overflow due to truncating to 16 bits