Fix Database error: undefined