My destruction platformer engine - movement issues.

File: www38.zippyshare.com/v/59670011/file.html

My problem is that pea is moving in funky ways when inside destroyed terrain. E.g. moving upwards on its own or sinking down like in quicksand. I think the problem is with my collision detection method to check when to stop pea, but I can’t think of any other that would work better. Can you help me?