Segfault occurs before it gets to outputting my debug messages(printf's), dunno why:(