fixed unset on  and added log in case of exception