fixed  bug in scala