Added libs option and fixed minor bugs