fixed some embarassing bugs