Fix a null pointer dereference

Hi Teodora,

Fixed the textmode recursive bug. Please pull.