BUGFIX: multiple tiny bugs