use exception instead of die()