Speaking from the JudeoChristian perspective, G-d judges us by our heart. So I guess that means if you think you are doing right, He is going to keep in mind you were doing what you thought was best. So, it follows, that if you are insane, He keeps that in mind.