Fixing checking so it doesn't enter unless there is data

Fixes #2