Some prepositions can also be adverbs. If one of these is followed by a nominal, it is a preposition. If not it is an adverb.