add memcheck. minor bug