fixed critical bugs