improve deallocate