save table and img, fixed bugs