Throw on non-function listener

Fix for #223
Test added