missing endif and endtry correced