Fixed problems with long detection