Fixed bug in app main template region scanning.