Replaced buffer by temporary file, because it could get big