Some API changes and minor fixes