Fixed memory leak, switched to vaarg api