releasing objects from array properly