fixed potential overflow issues with metadata footer