Fixed main functions for apps