need to check for null, otherwise instance mode will throw error