added if to catch z == None