Simplified field_end() // fixed a cast error in field_end()