Have you seen if the collision box is the same size?
Because it's likely that when the sprite is changed, the collision box will be a little bigger.
The bug has been fixed; I simply made the walls push the player if they detect that they are inside the walls.