Thanks for your help. I am attaching a picture to explain. There are 3 refractions in this case. The first is from air to glass. It works fine. The other two are from glass to air, they don't work properly. In the picture, I drew the normal in red. I drew the original beam direction in green and the direction of what we should expect for the refracted beam in purple.