Problem with use of detect