more fixes based on Antoine Trux's feedback