Medical image segmentation plays an important role in medical diagnosis, and has received extensive attention in recent years. A large number of convolutional neural network based methods have been proposed to achieve accurate segmentation results. Dice loss is the most popular loss function for medical image segmentation tasks. However, we found that Dice loss suffers from abnormal gradient changes, which causes the loss function to be unstable and difficult to converge. Therefore, we propose an gradient-optimized Dice loss (GODC) to solve this problem. GODC corrects the abnormal gradient changes in the segmentation loss, which accelerates the model convergence and can achieve better segmentation performance. Next, we propose a lateral feature alignment module (LFAM). LFAM adopts deformable convolutional network to align the features of different layers on the shortcut connections of U-Net to improve the segmentation performance. Finally, our method achieves state-of-the-art results on the LiTS dataset as well as our collected pancreatic tumor datasets.