application factory bug fix