Some fixes
thx to alpha197 for the corrections