Eliminate non-object errors on first and last posts