Fix some stuff involving calls to memcpy and memset