Testing and fix a segfault bug of render function (mutex used)