Fix undefined/null bug
Fix automatch dependency checking again