Fixes remaining bytes header calculation error

- Changes calculation to also return NSInteger
  to be able to return an error (-1)