I'm getting an IndexError when trying to download Process Statement Of Accounts

I just a created a new Process Statement Of Accounts and selected customers, set it to send ageing analysis and set the “Based On” property, but when I try to download the Statement, it does nothing, untill I checked the server logs and I see the following error:

"/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py", line 58, in get_report_pdf
20:23:32 web.1            |     aging[0]['ageing_based_on'] = doc.ageing_based_on
20:23:32 web.1            | IndexError: list index out of range

I see no error while using ERPNext, could this be a bug? Or did I miss something when creating the statement?