Converting to bytefield for magic module.
Fixes erros and test script.