Fixed index bug in updateTable & added try catch to catch in future