added more specs; fixed an issue with checking for undefined