Improved PBKDF2 type consistency and error checking