Preventing vanishing gradients with memory