Added memset for temporary buffer