Corrected errors in DB operation