Are you checking the value of @ERROR after the SHELL?

If there is a problem this might point you in the right direction.