fixed layout callback ordering & other bugs