Bug fixes, new API functions