fixing small but important bugs.