FIXING SOME BUGS