Fixing latex bugs so that it compiles