fixed potential bug when dealing with exception handling in resources