Fix plotting issue. Fix plotting time range to two hours. Fix bug in DB task code in states.py.