Edited error count code for DB