Resolve error in posts controller