Fixed an issue where texture state wasn't restored. Thanks to @gabor_papp, @sansumbrella and @batchass for reporting it.