fixed issues;
- missing var channel
- missing defines for offsets
- missing returns for 2 error cases