Add Invoice support and fix bug