Test added and bug fixed