fix random level generator + improve performance