[Fix] Undefined var in get_last_error

Causing this error to be reported instead of true error