fixed detection problem