fixed warn and replace 'printf' with 'log';