Bug fixes and improvement performance