fix error in posts controller on front-end