fixed submit function