Fixes javascript errors when you copy an app

See http://manage.dimagi.com/default.asp?62023#350793