fixed bugs for adding