refactor cart session attribute code, fix bugs