bug fix on real used memory