Fixed stupid errors causing memory corruptions.