Add missing typecast
remove unused variables