corrected uint-16 handling, general cleanup