Remove compile error from returning value in void function