Upvalue "ts" error fixed