Fixed some errors in generator and entities