fixed type error and moved a function

Change-Id: If95c7bed6f761a66469000c953c3a8986266ae46