the datastore['LPORT'].empty? is bad here because it isn't an string, it should be a Fixnum.