MMD animation fails in unity

I am not sure what is going on. The animation works well in mmd then when I want to use it in unity the legs are messed up. Does anyone know how to fix this?