Fixed the association system and error throwing.
Fixed so undefined variables are not printed.
Fixes for better JSHint compliance.