Fix bugs found by theaustria