malloc arguments were in wrong order