ApplicationMain fixes