Fixed problem with deallocate