Better error handling + initialisation of ca_path