changed secure route logic