Fixed API bugs and improved highly performance