fixes as suggested by mvidner