fix deviceready function