added more check in add method