Fix #274

Fix #274 and replace #310 
Thanks, I have addressed your comment and also realized that I was using
timestamp and now I'm using timestamptz.