a couple of fixes and some 4.0.4

Feel free to correct any mistake