viewport detection bug fixed