Fixed line 110: syntax error near unexpected token 'then'