Fix for #2504 (and more, see below)

Additionally, fixed method signature to match Poco.

This is a fix for #2504 (and more, see below)