First, replace this with couch_util:to_binary/1, second, instead of calling it all over the place, just add it into the handle_call clauses so that all of the Lang values are binaries as soon as you get them which will help not having to remember to add it everywhere we may not have converted yet.