IK chain/rest position help

When I switch from edit to pose mode, the IK chains in the legs move slightly out of their rest position even though all rotations etc. have been cleared in pose mode.

How do I stop this? Its making it impossible to weight paint as the out of position bones are pulling the mesh out of shape.

In Pose Mode Ctrl-A to apply the current (IK deformed pose) as the rest/edit pose . Then go into bone edit mode and select all and Ctrl-N just to be safe then re-apply the armature modifier to your mesh .