bug fixes and complex examples