Fix #499, #500
Fold constants (fix #504)
Fixing crash when a library's dependency could not be loaded.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>