Fixing issue with jquery change of directory layout