Fix a bug when the user's primary character does not have a valid mask for an application, and clean up the key mask evaluation code.

Signed-off-by: Tyler O'Meara <Tyler@TylerOMeara.com>