Fixing usage of pop.

Pop is undefined if its the first operation (later it can say
"empty" but if the first operation is a pop that leads to undefeined
behaviour).
Adding a missing static qualifier.