fixed possible nil-reference