fixed str to byte pattern (compatible with 2.x and 3)