detect is never called therefore condition using state is invalid, changed to directory check