Fix a bug in memcpy, implement memset, and remove model_thread