fix bug & improvements

fix when dbuser is create with resource limits
prepare for template (but not now)