I put a var_dump($db) before line 61 in sessions.php and it printed NULL.

The question is, why this global variable issue only affects the session code? Other zen-cart functions all work well - browsing products, adding to cart, etc... I would expect other functions also use "global" to pass in class objects, don't they?