Added error count code for DB