Fixed a bug of missing db var