fix #2 of error check in pages controller