putting detatch after hide and only if not already hidden