Fix bug in contrib_bintype: result was incorrect for type='both'