Fix problem with terminating on unaligned sizes