bug fix on DB operations
added test procedures for db operations