1. Added DB connection == null check in some cases
2. Updated comments