fixed issue with failing to write back to tables