Address some issues reported with Scrutinizer

Reference: https://scrutinizer-ci.com/g/BabDev/BabDev-Library/inspections/b3cb7831-3f2b-43c9-9d64-48ad31ae1fea