patched a performance bug

closing issue #113