Updated API and bugfix