Added support for attached entities

There was errors when tests was changed for not simulate dettach.