generic function for treating byte