Fix things

I'll comment line by line on Github to explain.