a few small but crucial fixes