Bugfix: loop when calling ajax method. Fixes issue 174