fix threshold check