There are "phantoms" of enemies on the client shuffled with the actual ones

Hello! The enemies do not spawn and destroy in the full sense, just show and hide. These functions are called only on the server. Those “phantoms” are seen from the game start, after killing some quantity of enemies of some type phantoms of that type seems to disappear (but not sure), but after restart appear again. Here is the hiding logic.