Added missing import.
Fixed method call typo.
Fixed error in detection of whether an overwrite is needed based on shape and type information.