Added more checks on passed vars