better exception handling in get_signature