works fine by correcting func declaration