fixed bug as requested