Minor API changes and fixing a bug