Changed warning to raising of ValueError