Bug fixes and Duplication check