Added some extra error handling for CTBencode.