Major bug fixes in editing and refreshTable