Fixed bug with unterminated string parsing

Added simple loop protector