fix error handling
add getopt for examples