fixed the panel relocation function