bug fixes and change shop_id to reference sql shop id instead of shop_code