fixed alter function by removing wrong optimization