Oklahoma judge rules man who spent nearly 50 years in prison