Fixed some unwrapping errors and updated some externs