modified built in head and tail to use assert macro