use volatile in order to fix app reset