On the converse theorem for Borcherds products