add function for waiting loader to be invisible.