fix multiple tiny bugs