Replace try by if