Fixed the wrong checking of function declarations
Down to one segfault maybe?