Fixed bug in text.expect for init and open