check that winnr key is actually available before accessing it (fixes #33)