Fix undefined issues in completion