fixed bug and formatted