add testing and fix bug for creating a new post