Feature/38 fix byte padding issues

Fixes #38