Added save, fixed bug

Added "Save" functionality, fixed subtle bug for non-rectangular tables.
Update