Fixed code to work with data definition