fix nil and present check