Calculate application sizes correctly

Thanks to Pierre-Hugues Husson for looking at my code and finding out
that the application sizes were not being calculated properly!

Change-Id: I68af6a9e5d1b2b7e60c0409b55d8ee578e567a69