Fixed writing empty bytes