got rid of unused variable N
bugfix and removal of unused variable in qfunc