Fix bugs in compilation