Improve user_pages tests and flash code