replace die() for database error