Helpers and bug fixes