fixed logging problem and data to bytes conversion