Fix function was used before it was defined

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>