Bugfixes: undefined values and fact timeout

This PR contains a couple bugfixes that I found useful during deployment. It might not be the best way to implement theses fixes, it's up for discussion.