fixed some bugs with system libraries and ir generation and the naive code generator