fixed memory leak in getPrompt