Bug fix: using plain functions throws NullPointerException