Fixed loc function.