Fixed memory corruption and renamed parameter