Fixed range

Added range check