fix bug in application wrap fn; (Case: 56248)

Should fix http://manage.dimagi.com/default.asp?56248#315470

Though it seems odd that this app has no modules (an untitled module is created when you create an app, and even when you delete that module, app.modules is still stored/set as an empty list), this might be an indication of some different problem.