some API changes to make it more stable
minor fix