Some changes, bug fixes