function for reversing bytes