try catch added to minimize crashes