Some small changes and bug fixes