Fix test error and warnings