Adding some checks for nil cart objects