checked and fixed bug