Fixing unused and undefined in master

Please have a look at the commit messages - each 'error class' is reflected in it's own commit.

@bartv2 @LukasReschke @Raydiation @butonic