catch exceptions to avoid unexpected crash