Safety added to recursion:average