Upgraded libraries to the latest, fixed code