catch exceptions, check for nil