now correctly writes value in field