Fixed bug in detector