Fixed non-void function not returning