Uploaded sketch not working after power off

It sounds like a timing issue. Once the sketch is uploaded it should stay there.

One thing people do (as PaulS suggested) is to flash an LED a few times to indicate "startup" progress. eg.

1 flash - booted
2 flashes - found Wifly shield
3 flashes - connected

and so on.