This should fix cast exceptions.