minor bug fixing, cleanup