fix bugs and complete linking applications