fixed references to Yii::app()->db