updated scan_detector

got rid of mem leaks